package org.king.mapper;


import org.apache.ibatis.annotations.*;
import org.king.entity.User;

import java.util.List;

@Mapper
public interface UserMapper {
    @Insert("insert into users(account,password,email,role) values(#{account},#{password},#{email},#{role})")
    int insertUser(@Param("account") String account,@Param("password") String password,@Param("email") String email,@Param("role") String role);

    @Select("select * from users where account=#{account} and password=#{password}")
    User getUser(@Param("account") String account,@Param("password") String password);

    @Select("select * from users where account=#{account}")
    User getUserByAccount(@Param("account") String account);

    @Select("select * from users")
    List<User> getUsers();

    @Delete("delete * from users where id=#{userId}")
    int deleteUser(@Param("userId") int userId);
}
